//
//  NetRequest.h
//  NetRequesProject
//
//  Created by 蓓蕾 on 2021/9/6.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NetRequest : NSObject

/// 以get方式发送网络请求
/// @param URLString 请求的网址字符串
/// @param parameters 请求的参数
/// @param success 请求成功
/// @param failure 请求失败
+ (void)GetWithUrlString:(NSString *)URLString
              parameters:(nullable id)parameters
                 success:(nullable void (^)(id _Nullable responseObject))success
                 failure:(nullable void (^)(NSError *error))failure;

/// 以post方式发送网络请求
/// @param URLString 请求的网址字符串
/// @param parameters 请求的参数
/// @param success 请求成功
/// @param failure 请求失败
+ (void)PostWithUrlString:(NSString *)URLString
               parameters:(nullable id)parameters
                  success:(nullable void (^)(id _Nullable responseObject))success
                  failure:(nullable void (^)(NSError *error))failure;

/** 以POST（form-data）的方式请求数据 */
+ (void)POSTWithFormData:(NSString *)url params:(nullable id)params successBlock:(nullable void (^)(id _Nullable responseObject))successBlock failureBlock:(nullable void (^)(NSError *error))failureBlock;


/// 通过Body方式请求  在postman中使用Body → raw的方式进行请求
/// @param URLString 请求地址
/// @param parameters 请求参数
/// @param showLog 是否打印日志
/// @param title 打印日志前缀
/// @param success 成功的回调
/// @param failure 失败的回调
+ (void)POSTWithBodyRow:(NSString *)URLString parameters:(nullable id)parameters showLog:(BOOL)showLog logTitle:(nullable NSString *)title success:(nullable void (^)(id _Nullable responseObject))success failure:(nullable void (^)(NSError *error))failure;

/// 通过Body方式请求  在postman中使用Body → raw的方式进行请求
/// @param URLString 请求地址
/// @param parameters 请求参数
/// @param showLog 是否打印日志
/// @param title 打印日志前缀
/// @param success 成功的回调
/// @param failure 失败的回调
+ (void)GETWithBodyRow:(NSString *)URLString parameters:(nullable id)parameters showLog:(BOOL)showLog logTitle:(nullable NSString *)title success:(nullable void (^)(id _Nullable responseObject))success failure:(nullable void (^)(NSError *error))failure;

@end

NS_ASSUME_NONNULL_END
